<?php
/**
 * Created by IntelliJ IDEA.
 * User: Fernando
 * Date: 15/10/2014
 * Time: 23:46
 */
use Symfony\Component\HttpKernel\Controller\ControllerReference;
echo $view['actions']->render(new ControllerReference('FiestissimaCRM:Index:header'));

?>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h2 class="page-header">Clientes </h2>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <i class="fa fa-building fa-fw"></i> Empresas
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="table-responsive" id="divTableClientesEmpresa">
                                    <?php
                                    if(count($clientes)>0)
                                    {
                                    ?>
                                    <table class="table table-bordered table-hover table-striped" id="tableClientesEmpresa">
                                        <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Razon Social</th>
                                            <th>Contacto</th>
                                            <th>Cuit</th>
                                            <th>Nro Cuit</th>
                                            <th>&nbsp;</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <?php
                                            foreach($clientes as $c)
                                            {
                                                echo "
                                                        <tr>
                                                            <td>".$c->getCId()."</td>
                                                            <td>".$c->getCeRazonSocial()."</td>
                                                            <td>".$c->getCeContacto()."</td>
                                                            <td>".$c->getCTipoDoc()."</td>
                                                            <td>".$c->getCNroDoc()."</td>
                                                            <td>
                                                                <button id=\"btnVerDetalle\" type=\"button\" class=\"btn btn-primary btn-sm\" data-toggle=\"modal\" data-target=\"#agregarClienteModal\">
                                                                <i class=\"fa fa-edit fa-fw\"></i> Ver detalles
                                                                </button>
                                                            </td>
                                                        </tr>
                                                    ";
                                            }
                                        ?>
                                        </tbody>
                                    </table>
                                    <?php
                                    }else {
                                        echo "No hay empresas registradas como clientes.";
                                    }
                                    ?>
                                </div>
                                <!-- /.table-responsive -->
                            </div>
                            <!-- /.col-lg-4 (nested) -->
                        </div>
                        <!-- /.row -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->

<?php echo $view->render('FiestissimaCRM:Default:footer.html.php'); ?>